import React, { Component } from 'react';
import '../../../styles/index/Home/Seckill.scss'
import { pro_seckilllist } from "../../../api/index";

class Seckill extends Component {
  constructor(props) {
    super(props)
    this.state = {
      list: []
    }
  }
  async componentDidMount() {
    var res = await pro_seckilllist()
    // console.log(res);
    if (res.data.code == 200) {
      this.setState({ list: res.data.data })
    }
  }
  render() {
    return (
      <div className='home_seckill'>
        <div className="home_seckill_title">
          <div className="home_seckill_title_left">嗨购秒杀</div>
          <div className="home_seckill_title_right">爆款轮番秒</div>
        </div>
        <div className="home_seckill_list">
          {
            this.state.list.map((item, index) => {
              return (
                <figure key={index}>
                  <figcaption><img src={item.img1} alt="" /></figcaption>
                  ￥{item.originprice}
                </figure>
              )
            })
          }
        </div>
      </div>
    );
  }
}

export default Seckill;